/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package freechoicepn.datamodel;

import java.util.ArrayList;

/**
 *
 * @author Tomas
 * 
 * Trieda reprezentujuca prechody
 */
public class Transition implements Comparable<Transition> {
    
    private int id;
    private String label;   // nazov prechodu
    private ArrayList<Place> inPlaces;

    public Transition(int id, String label) {
        this.id = id;
        this.label = label;
        this.inPlaces = new ArrayList();
    }
    
    public void addInPlace(Place p) {
        this.inPlaces.add(p);
    }

    @Override
    public String toString() {
        return "id: " + id + " label: " + label + "\n";
    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Transition) {
            Transition transition = (Transition)obj;
            
            if (transition.getId() == this.id) {
                return true;
            }
        }
        
        return false;
    }

    @Override
    public int compareTo(Transition t) {
        return this.id - t.getId();  
    }
    
    public int getId() {
        return id;
    }
    
    public ArrayList<Place> getInPlaces() {
        return inPlaces;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
    
    
}
